﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;

namespace OAWeb.Models
{
    public class DbInitializer:DropCreateDatabaseIfModelChanges<OADbContext>
    {
        protected override void Seed(OADbContext context)
        {
            // 在下面添加数据初始化代码
            context.Departments.AddRange(new List<Department> {
                new Department
                {
                    DepartmentID =001,
                    DepartmentName="小学部",
                    CreateYear=  DateTime.Parse("1994/9/1"),
                    Leader="张三"


                } ,
                new Department
                {
                    DepartmentID =002,
                    DepartmentName="初中部",
                    CreateYear=  DateTime.Parse("2000/9/1"),
                    Leader="李磊"


                },
                 new Department
                {
                    DepartmentID =003,
                    DepartmentName="高中部",
                    CreateYear=  DateTime.Parse("2003/9/1"),
                    Leader="张一山"


                }
            });
            context.DepartmentGrades.AddRange(new List<DepartmentGrade> {
                new DepartmentGrade
                {
                    ID=001,
                    Name="小学1年级",
                    DepartmentID=001,
                    CreatYear=DateTime.Parse("1994/9/1"),
                    Leader="李强"

                },
                 new DepartmentGrade
                {
                    ID=002,
                     Name="初一年级",
                    DepartmentID=002,
                    CreatYear=DateTime.Parse("2000/9/1"),
                    Leader="林雯"

                },
                 new DepartmentGrade
                {
                    ID=003,
                    Name="高1年级",
                    DepartmentID=003,
                    CreatYear=DateTime.Parse("2003/9/1"),
                    Leader="高雄"

                }



            });
            context.TeachingClasses.AddRange(new List<TeachingClass> {
                new TeachingClass
                {
                    TeachingClassID=001,
                    DepartmentGradeID=001,
                    ClassName="1级1班",
                    TeacherID=004
                },
                new TeachingClass
                {
                    TeachingClassID=002,
                    DepartmentGradeID=002,
                    ClassName="7级1班",
                    TeacherID=003
                },
                new TeachingClass
                {
                    TeachingClassID=003,
                    DepartmentGradeID=002,
                    ClassName="7级2班",
                    TeacherID=001
                },
              new TeachingClass
                {
                    TeachingClassID=003,
                    DepartmentGradeID=003,
                    ClassName="高一1班",
                    TeacherID=002
                }

            });
            context.Teachers.AddRange(new List<Teacher> {
                new Teacher
                {
                    ID=001,
                    Name="张珲",
                    Sex="男",
                    BornDate=DateTime.Parse("1988/9/1"),
                    DepartmentID=001,
                    Degree="硕士"
                },
                 new Teacher
                {
                    ID=002,
                    Name="章铭",
                    Sex="男",
                    BornDate=DateTime.Parse("1976/9/1"),
                    DepartmentID=003,
                    Degree="博士"
                },
                  new Teacher
                {
                    ID=003,
                    Name="袁小宙",
                    Sex="男",
                    BornDate=DateTime.Parse("1981/5/21"),
                    DepartmentID=002,
                    Degree="硕士"
                },
                   new Teacher
                {
                    ID=004,
                    Name="彭珊",
                    Sex="女",
                    BornDate=DateTime.Parse("1989/11/8"),
                    DepartmentID=001,
                    Degree="硕士"
                },

            });
            context.Students.AddRange(new List<Student> {
                new Student
                {
                    ID=001,
                    Number="1740001",
                    TeachingClassID=001,
                    Name="叶天",
                    Sex="男",
                    Nation="汉",
                    Birthday=DateTime.Parse("1998/9/1"),
                    IDNumber="440882199809015213",
                    StudentTypeID=1
                },
                 new Student
                {
                    ID=002,
                    Number="1740002",
                    TeachingClassID=001,
                    Name="袁州",
                    Sex="男",
                    Nation="汉",
                    Birthday=DateTime.Parse("1999/9/1"),
                    IDNumber="440882199809015846",
                    StudentTypeID=1
                },
                 new Student
                {
                    ID=003,
                    Number="1740003",
                    TeachingClassID=002,
                    Name="林雯",
                    Sex="男",
                    Nation="汉",
                    Birthday=DateTime.Parse("1998/9/1"),
                    IDNumber="440882199809015213",
                    StudentTypeID=2
                },
                 new Student
                {
                    ID=004,
                    Number="1740004",
                    TeachingClassID=002,
                    Name="高伟豪",
                    Sex="男",
                    Nation="汉",
                    Birthday=DateTime.Parse("1998/9/1"),
                    IDNumber="440882199809015213",
                    StudentTypeID=3
                },
            });

            context.Grades.AddRange(new List<Grade> {
                new Grade
                {
                    StudentID=001,
                    ExamID=001,
                    CourseID=001,
                    Score=95,
                   
                },
                new Grade
                {
                    StudentID=002,
                    ExamID=001,
                    CourseID=001,
                    Score=65,

                },
               
                 new Grade
                {
                    StudentID=001,
                    ExamID=001,
                    CourseID=002,
                    Score=80,
                    
                },
                  new Grade
                {
                    StudentID=002,
                    ExamID=001,
                    CourseID=002,
                    Score=90,

                },
               
                  new Grade
                {
                    StudentID=001,
                    ExamID=001,
                    CourseID=003,
                    Score=70,
                   
                },
                   new Grade
                {
                    StudentID=002,
                    ExamID=001,
                    CourseID=003,
                    Score=95,

                },
         

            });


            context.CourseExams.AddRange(new List<CourseExam> {

                new CourseExam
                {
                    CourseID=2,
                    ExamID =001,
                    FullMark=100,



                },
               new CourseExam
                {
                    CourseID=1,
                    ExamID =001,
                    FullMark=100,



                },
               new CourseExam
                {
                    CourseID=3,
                    ExamID =001,
                    FullMark=100,



                },




            });

            context.Exams.AddRange(new List<Exam> {

                new Exam
                {
                    ID=001,
                    ExamName="第一次月考",
                    DepartmentGradeID =001,
                    ExamDate=DateTime.Parse("2018/9/1"),
                    


                },
               




            });
            context.Courses.AddRange(new List<Course>
            {
                new Course
                {
                    ID=001,
                    DepartmentGradeID=003,
                    Subject="数学",
                   
                    
                    CoursesOfferedID=2
                },

                new Course
                {
                    ID=002,
                    DepartmentGradeID=002,
                    Subject="语文",
                    CoursesOfferedID=1
                },
                new Course
                {
                    ID=003,
                    DepartmentGradeID=003,
                    Subject="英语",
                    CoursesOfferedID=3
                }






            });
            context.CoursesOffereds.AddRange(new List<CoursesOffered>
            {
                new CoursesOffered
                {
                    ID=1,
                    Courses="语文",
                    Remark="文学之类的"

                }
                ,
                new CoursesOffered
                {
                    ID=2,
                    Courses="数学",
                    Remark="计算类的"

                },
                new CoursesOffered
                {
                    ID=3,
                    Courses="英语",
                    Remark="一门常用的外语"

                },
                new CoursesOffered
                {
                    ID=4,
                    Courses="生物",
                    Remark="暂无"

                },
                new CoursesOffered
                {
                    ID=5,
                    Courses="地理",
                    Remark="暂无"

                },
                new CoursesOffered
                {
                    ID=6,
                    Courses="生物",
                    Remark="物理"

                },
                new CoursesOffered
                {
                    ID=7,
                    Courses="画图",
                    Remark="教一下简单的画画技术"

                },
                new CoursesOffered
                {
                    ID=8,
                    Courses="信息技术",
                    Remark="简单的电脑操作"

                },
                new CoursesOffered
                {
                    ID=9,
                    Courses="体育",
                    Remark="运动是身体健康的基础"

                },
                new CoursesOffered
                {
                    ID=10,
                    Courses="音乐",
                    Remark="鉴赏一些流行或古典的音乐和简单的唱"

                },
                new CoursesOffered
                {
                    ID=11,
                    Courses="其它",
                    Remark="等等"

                }






            });
            context.StudentTypes.AddRange(new List<StudentType> {

                new StudentType
                {
                    StudentTypeID=001,
                    Type="正取生"



                },
                 new StudentType
                {
                    StudentTypeID=002,
                    Type="备取生"



                },
                  new StudentType
                {
                    StudentTypeID=003,
                    Type="往届生"



                }




            });

            base.Seed(context);
        }
    }
}